import {
    getCompanytist,
    getCompanyDetail
} from '../../api/article'
import {formatTime}   from '../../utils/util'
// pages/company/company.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        company:{},
        id:''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.init(options.id)
        this.setData({
            id:options.id
        })
    },
    async init(id) {
       const res = await getCompanyDetail({
        companyId:id
       })
       res.content.setupTime = formatTime(res.content.setupTime)
       res.content.imgs = JSON.parse(res.content.imgs)
       res.content.detail = JSON.parse(res.content.detail)
       this.setData({
           company:res.content
       })
       console.log(res)
    },
    onShareAppMessage() {
        return{
            title:'健享经纪',
            path:'/pages/company/company?id='+ this.data.id
        }
    }
})